<template>
  <div>
    订单号：{{ orderObj.id }}<br>
    收货人：{{ orderObj.receiver }}<br>
    送货地址：{{ orderObj.addr }}<br>
    收货人电话：{{ orderObj.phone }}<br>
    下单时间：{{ orderObj.date }}<br>
    订单总价：{{ orderObj.priceTotal }}<br>
    订单状态：{{ orderObj.status }}<br>
    <h2>订单详情</h2>
    <el-table :data="orderObj.detailsList" style="width: 100%">
      <el-table-column prop="productBean.id" label="商品编号" width="180"/>
      <el-table-column prop="productBean.name" label="商品名" width="180"/>
      <el-table-column prop="productBean.price" label="单价" width="180"/>
      <el-table-column prop="number" label="购买数量" width="180"/>
    </el-table>
    <el-button type="primary" @click="send(orderObj.id)">发货</el-button>
    <el-button type="primary" @click="$router.push('/managerOrder')">返回</el-button>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      orderObj: {},
    }
  },
  methods: {
    findById(id) {
      axios.get("/project/order/findById", {params: {id}})
          .then(resp => {
            this.orderObj = resp.data;
          })
    },
    send(id) {
      axios.get("/project/order/send", {params: {id}}).then(resp => {
        if (resp.data == "ok") {
          this.$router.push("/managerOrder");
        }
      })
    }
  },
  created() {
    this.findById(this.$route.query.id);
  }
}
</script>

<style scoped>

</style>